<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

/*
** etc:  初始加载方法
** author: deepe.xiao
** update: 2018-10-10
*/
include_once BASEPATH.'deepe.common.php';
include_once BASEPATH.'deepe.route.php';
include_once BASEPATH.'deepe.controller.php';
include_once BASEPATH.'deepe.model.php';

header("Content-type:text/html; charset=".config_item('charset'));
date_default_timezone_set( config_item('timezone') );
ini_set('session.gc_maxlifetime',config_item('session_expire_time') ); 
session_name("KINGID");
session_start();

$_REQUEST['action'] =  isset( $_REQUEST['action']) ? trim( $_REQUEST['action'] ) : config_item("action");
$_REQUEST['func'] = isset( $_REQUEST['func']) ? trim( $_REQUEST['func'] ) : config_item("func");
$admin =  isset( $_REQUEST['admin']) ? trim( $_REQUEST['admin'] ) : 'index';


if( isset( $_REQUEST['code'])&&!isset( $_REQUEST['action'])) { $control = "pay";  $function = "wxpay"; }
if( isset( $_REQUEST['exterface']) && isset( $_REQUEST['sign'])){ $control = "pay";  $function = "alipayReturn"; }

$route = new Route();
if( $_REQUEST['action'] != '' && $admin == 'index'){
	$obj = $route -> autoLoadClass( $_REQUEST['action'] );
} else{
	$obj = $route -> autoLoadAdmin( $admin );
}

if( method_exists ( $obj , $_REQUEST['func'] ) ){
	$function = $_REQUEST['func'];
	$obj->$function();
}else{
	view_log( "deepe Framework Error " , "not function exists, you send function is ". $_REQUEST['func'] );
}

?>
